#ifndef __NIO_H
#define __NIO_H

#define ACTION_READ 1
#define ACTION_WRITE 1 << 1
#define ACTION_ERROR 1 << 2

struct FiredEvent{
	int fd;
	int action;    /* 触发事件的原因  */
};
/*
 * 初始化所需的kqueue或者epoll
 * @return 返回一个特殊的指针， 后续的参数调用需要使用此指针
 */
void* nioInit();
int nioRegisteFd(void* poll, int fd, int actions);
int nioUnRegisteFd(void* poll, int fd, int actions);
void nioClose(void* poll);

/*
 * wait until something you are interested in happends. 
 */
int nioWait(void* poll, struct FiredEvent* firedEvent, int firedEventLen);
#endif /* __NIO_H  */
